import numpy
import scipy.linalg
'''Calculation of simple one dimenional heat transfer through a wall
        with convection on both sides.
	q'' = h1*(T1-Tw1) = k/t * (Tw1-Tw2) = h2 * (Tw2 - T2)
	units are m, kg, s, K
'''
wallThick = 0.035*0.0254
def convWall(h1,T1,h2,T2,k=300.,t=wallThick):
    '''Returns q\'\',Tw2,Tw1)'''
    A = numpy.array([[-1,h2,0], 
                [-1,-k/t,k/t],
                [-1,  0, -h1]])
    C = numpy.array([h2*T2 , 0 , -h1*T1])
    B = scipy.linalg.solve(A, C)
    return((B[0],B[1],B[2]))
